const api = require('../../../ws_micro_shop/utils/api.js');
const app = getApp();

Page({
  data: {
    theme: app.themeData,
    height: wx.systemInfo.windowHeight,
    useTabbar: !(app.tabbarindex === 0 && app.siteInfo.tabbar_type === '1'),
    taskList: [
      {
        name: '推销新品',
        title: '向客户分享新品',
        attr: 'new_goods',
        url: '/ws_micro_shop_guide/pages/share/index?id=1',
      },
      {
        name: '推销热销产品',
        title: '向客户分享热销商品',
        attr: 'hot_goods',
        url: '/ws_micro_shop_guide/pages/share/index?id=2',
      },
      {
        name: '推销任意商品',
        title: '向客户分享任意商品',
        attr: 'all_goods',
        url: '/ws_micro_shop_guide/pages/share/index?id=0',
      },
      {
        name: '分享限时折扣',
        title: '向客户分享限时折扣商品',
        attr: 'share_discounts',
        url: '/ws_micro_shop_guide/pages/share/index?id=3',
      },
      {
        name: '分享秒杀',
        title: '向客户分享秒杀商品',
        attr: 'share_ms',
        url: '/ws_micro_shop_guide/pages/share/index?id=4',
      },
      {
        name: '分享优惠券',
        title: '向客户分享优惠券',
        attr: 'share_coupons',
        url: '/ws_micro_shop_guide/pages/share/coupon/coupon',
      },
      {
        name: '拉新会员',
        title: '拉新',
        attr: 'new_member',
        url: '',
      },
    ],
  },
  onLoad(opts) {
    app.pageOnLoad(this);
  },
  onShow() {
    this.getWeekReport();
  },
  getWeekReport() {
    let _this = this;
    wx.showLoading({
      title: '正在加载...',
      mask: true,
    });
    app.ws_micro_shoprequest({
      url: api.staff.week_report,
      success: function (res) {
        wx.hideLoading();
        if (res.code === 0) {
          _this.setData({
            numList: res.data.assign,
            week: res.data.week,
          });
        }
      },
    });
  },
  collectFormId(e) {
    app.collectFormId(e);
  },
});
